package com.example.pattern.facade;

/**
 * 外观类应用
 *
 * @author FM_南风
 * @date 2024/7/2
 */
public class ComputerFacade {
   private final CPU cpu;
   private final Memory memory;
   private final HardDrive hardDrive;

   public ComputerFacade() {
    this.cpu = new CPU();
    this.memory = new Memory();
    this.hardDrive = new HardDrive();
   }

   public void start() {
    cpu.freeze();
    memory.load(1L, hardDrive.read(2L, 3));
    cpu.jump(1L);
    cpu.execute();
   }

 public static void main(String[] args) {
  ComputerFacade computer = new ComputerFacade();
  computer.start();
 }
}
